//
//  MIDIhairCell.m
//  迷笛
//
//  Created by . on 2018/9/18.
//  Copyright © 2018年 🍃🌺🌺🍃. All rights reserved.
//

#import "MIDIhairCell.h"

@implementation MIDIhairCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        [self addSubview:self.headiamge];
        [self.headiamge mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_offset(WidthScale(21));
            make.left.mas_offset(WidthScale(15));
            make.width.mas_offset(WidthScale(41));
            make.height.mas_offset(kDevice_Is_iPhoneX?HeighX(41):HeightScale(41));
        }];
        [self addSubview:self.name];
        [self.name mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.headiamge);
            make.left.equalTo(self.headiamge.mas_right).offset(WidthScale(10));
            [self.name setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
        }];
//        [self addSubview:self.replymy];
//        [self.replymy mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.top.equalTo(self.name.mas_bottom).offset(WidthScale(-5));
//            make.left.equalTo(self.name);
//            [self.replymy setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
//        }];
        [self addSubview:self.content];
        [self.content mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.name.mas_bottom).offset(5);
            make.left.equalTo(self.name);
            make.width.mas_offset(WidthScale(294));
            //            make.height.mas_offset(kDevice_Is_iPhoneX?HeighX(100):HeightScale(100));
        }];
        [self addSubview:self.viewback];
        [self.viewback mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.content.mas_bottom).offset(5);
            make.left.equalTo(self.name);
            make.width.mas_offset(WidthScale(294));
            make.height.mas_offset(kDevice_Is_iPhoneX?HeighX(65):HeightScale(65));
            make.bottom.mas_offset(WidthScale(-20));
        }];
        [self addSubview:self.iamge];
        [self.iamge mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.viewback);
            make.left.equalTo(self.name);
            make.width.mas_offset(WidthScale(65));
            make.height.mas_offset(kDevice_Is_iPhoneX?HeighX(65):HeightScale(65));
        }];
        [self addSubview:self.smallText];
        [self.smallText mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.viewback).mas_offset(10);
            make.left.equalTo(self.iamge.mas_right).mas_offset(WidthScale(10));
            make.width.mas_offset(WidthScale(205));
            make.height.mas_offset(kDevice_Is_iPhoneX?HeighX(40):HeightScale(40));
        }];
        
    }
    return self;
}
-(UIButton *)headiamge
{
    if (!_headiamge)
    {
        _headiamge =[[UIButton alloc]init];
        _headiamge.layer.masksToBounds = YES;
        [_headiamge.layer setCornerRadius:WidthScale(20)]; //设置矩圆角半径
    }
    return _headiamge;
}
-(UILabel *)name
{
    if (!_name)
    {
        _name =[[UILabel alloc]init];
        _name.textColor = [UIColor colorWithHexString:@"#FF005D"];
        _name.font = [UIFont systemFontOfSize:WidthScale(15)];
    }
    return _name;
}
//-(UILabel *)replymy
//{
//    if (!_replymy)
//    {
//        _replymy =[[UILabel alloc]init];
//        _replymy.text = @"回复  美嘉:";
//        _replymy.font=[UIFont systemFontOfSize:WidthScale(12)];
//        _replymy.textColor = [UIColor colorWithHexString:@"#FFFFFF"];
//    }
//    return _replymy;
//}
-(UILabel *)content
{
    if (!_content)
    {
        _content =[[UILabel alloc]init];
        _content.font =[UIFont systemFontOfSize:WidthScale(14)];
        _content.numberOfLines = 0;
        _content.textColor = [UIColor colorWithHexString:@"#FFFFFF"];
        
        _content.lineBreakMode = NSLineBreakByWordWrapping;
        CGSize size = [_content sizeThatFits:CGSizeMake(WidthScale(200), MAXFLOAT)];//根据文字的长度返回一个最佳宽度和高度
        _content.frame = CGRectMake(0, 0, WidthScale(200), size.height);
        
    }
    return _content;
}
-(UIView *)viewback
{
    if (!_viewback)
    {
        _viewback =[[UIButton alloc]init];
        [_viewback setBackgroundColor:[UIColor colorWithHexString:@"#E4E4E4"]];
    }
    return _viewback;
}
-(UIImageView *)iamge
{
    if (!_iamge)
    {
        _iamge =[[UIImageView alloc]init];
    }
    return _iamge;
}
-(UILabel *)smallText
{
    if (!_smallText)
    {
        _smallText =[[UILabel alloc]init];
        _smallText.textColor = [UIColor colorWithHexString:@"#333333"];
        _smallText.font =[UIFont systemFontOfSize:WidthScale(13)];
        _smallText.numberOfLines = 0;
//        _smallText.lineBreakMode = NSLineBreakByWordWrapping;

    }
    return _smallText;
}

@end
